<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>应用和组件的实例</title>
</head>
<body>
    <div id="app"></div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.29/vue.global.prod.min.js"></script>
    <script>
        // 容器，父组件
        const app = Vue.createApp({
            data() {
                return {
                    name:"根组件-父亲",
                    
                }
            },
            template:`<div>{{name}}<xiasnn /></div>`
        });

        app.component('xiasnn',{
            data() {
                return {
                    name:"子组件"
                }
            },
            template:`<p style="color:white;background-color:red;">{{name}}</p>`
        })

        // 根组件的对象
        const vm = app.mount('#app');   //挂载
    </script>
</body>
</html>